#!/usr/bin/env python
Import('env')

# custom build action for the tex file
stylesheet = File('../common/mystyle.sty')
bld_action = ' '.join([
    'rst2latex.py',
    '--use-latex-toc', 
    '--use-latex-citations', 
    '--stylesheet=' + str(stylesheet),
    '$SOURCES', '>', '$TARGET'])

bld = Builder(action=bld_action)
env.Append(BUILDERS={'rst2tex' : bld})
env.rst2tex('design.tex', 'design.rst')

# now build the .pdf from the .tex file
env.Append(LATEXRETRIES=5)
t = env.PDF('design.pdf', ['design.tex'])
Default(t)
